home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / shcgen.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.3 KB  |  56 lines

  1. /* Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: shcgen.h,v 1.2 2000/09/19 19:00:50 lpd Exp $ */
  20. /* Interface for Huffman code generation */
  21. /* Requires shc.h */
  22.  
  23. #ifndef shcgen_INCLUDED
  24. #  define shcgen_INCLUDED
  25.  
  26. /* Compute an optimal Huffman code from an input data set. */
  27. /* The client must have set all the elements of *def. */
  28. /* The definition is guaranteed to be well-behaved. */
  29. int hc_compute(P3(hc_definition * def, const long *freqs, gs_memory_t * mem));
  30.  
  31. /* Convert a definition to a byte string. */
  32. /* The caller must provide the byte string, of length def->num_values. */
  33. /* Assume (do not check) that the definition is well-behaved. */
  34. /* Return the actual length of the string. */
  35. int hc_bytes_from_definition(P2(byte * dbytes, const hc_definition * def));
  36.  
  37. /* Extract num_counts and num_values from a byte string. */
  38. void hc_sizes_from_bytes(P3(hc_definition * def, const byte * dbytes, int num_bytes));
  39.  
  40. /* Convert a byte string back to a definition. */
  41. /* The caller must initialize *def, including allocating counts and values. */
  42. void hc_definition_from_bytes(P2(hc_definition * def, const byte * dbytes));
  43.  
  44. /* Generate the encoding table from the definition. */
  45. /* The size of the encode array is def->num_values. */
  46. void hc_make_encoding(P2(hce_code * encode, const hc_definition * def));
  47.  
  48. /* Calculate the size of the decoding table. */
  49. uint hc_sizeof_decoding(P2(const hc_definition * def, int initial_bits));
  50.  
  51. /* Generate the decoding tables. */
  52. void hc_make_decoding(P3(hcd_code * decode, const hc_definition * def,
  53.              int initial_bits));
  54.  
  55. #endif /* shcgen_INCLUDED */
  56.